package StudyCode.summary.myfile;

import java.net.URI;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CreatePathRelativeToRoot {
	public static void main(String[] args) {
		Path path01 = Paths.get("folder1/folder2/folder3/test.txt");
		System.out.println(path01);
		Path path02 = Paths.get("/folder1", "folder2/folder3/test.txt");
		System.out.println(path02);
		Path path03 = FileSystems.getDefault().getPath("/folder1/folder2/folder4", "test.txt");
		System.out.println(path03);
		Path path04 = FileSystems.getDefault().getPath("/folder1/folder2/folder3/test.txt");
		System.out.println(path04);
		Path path05 = Paths.get(URI.create("file:///folder1/folder2/folder3/test.txt"));
		System.out.println(path05);
	}
}
